Version 3.0
User's Guide

Commands: Counters

Previous | Next
Contents

<INSERT_COUNT counter>

INSERT_COUNT will place an incremental number in the document. The number increases by one each time the command is executed.

The "counter" field allows you to specify a name for different counters. A name is not required, but is used so that you can maintain individual page counters. NetCloak will track the value of counters with different names separately. If no "counter" is specified, then a default counter is used. The counter name is not case sensitive.

Here is an example:

    Cloaked documents served: <INSERT_COUNT>    <P>    This page served: <INSERT_COUNT ThisPage>

You could include this example in any number of cloaked documents, changing the counter name "ThisPage" in each document. The first counter in this example (without the counter name) would be incremented each time any of these pages was accessed, whereas the second counter would be incremented for each individual page.

To display a counter without updating it, use the variation <INSERT_COUNT#>. For example:

    This document served: <INSERT_COUNT MyPage>    <P>    That's <INSERT_COUNT# MyPage> times!
    <P>    <INSERT_COUNT# MyPage> is quite a few times!
    <P>    Home Page has been accessed <INSERT_COUNT#> times.

This page would only increment the "MyPage" counter once, and would not increase the default counter (used, in this case, for the "Home Page") at all.

You can also increment counters without displaying them by using the variation <INSERT_COUNT*>. This allows you to increment counters on each page of your server and then display them on a separate statistics page.

Counters may be preset to any value using the "Counters" tab of the "Lists" window. See the "Configuring NetCloak" section below for details. When you define a counter in the Lists window, you can also have the counter automatically reset itself at specified intervals.

NetCloak limits the number of individual counters to 512. See the section "Adjusting Internal Settings" for information on how this limit can be increased, if necessary.

<HIDE_COUNT counter operator val1 val2 ...> OR
<HIDE_COUNT lowval highval counter>

In addition to displaying page counters, you can show and hide based on their values.

If the first parameter is a number, HIDE_COUNT checks the counter with the name specified by the "counter" parameter to see if it falls within the range defined by the "lowval" and "highval" parameters. If the counter name is omitted, the default counter is assumed. Here is an example:

    This document served <INSERT_COUNT MyPage> times.
    <HIDE_COUNT 0 50 MyPage>    <P>This line will be shown only after the page has been accessed 50   times.
    <SHOW>

If the first parameter is not a number, it is treated as a counter name, and the text is hidden if the counter's current value satisfies the comparison with any of the given value parameters. If the comparison operator is omitted, the counter must exactly equal one of the given values. To test the value of the default counter, use either a pair of double-quotes, or use the name "Default". Thus, the previous example could also be written as:

    This document served <INSERT_COUNT MyPage> times.
    <HIDE_COUNT MyPage LT 50>    <P>This line will be shown only after the page has been accessed 50 times.
    <SHOW>

Note that the HIDE_COUNT command does not increment the counter, so you will normally need to use this command in conjunction with either INSERT_COUNT or INSERT_COUNT*.

<SHOW_COUNT counter operator val1 val2 ...> OR
<SHOW_COUNT lowval highval counter>

This command is the SHOW version of the count commands. See HIDE_COUNT for details on how it works. The SHOW_COUNT command works exactly the same way, except that text becomes shown instead of hidden. For example, the following section would give a special note to the 100th person accessing your site:

    <INSERT_COUNT* Winner>    <HIDE><SHOW_COUNT Winner == 100>    You are lucky visitor number 100!
    <SHOW>

<INSERT_COUNTERDATE counter offset format>

Counters are commonly reset occasionally, and NetCloak can do this for you at predefined intervals. To create a counter that periodically resets, see the "Configuring NetCloak" section below.

When a counter resets, you may want to display the date the counter started. The INSERT_COUNTERDATE command gives you an easy way to do this. For example:

    There have been <INSERT_COUNT PageHits> visitors to this page since 
    <INSERT_COUNTERDATE PageHits>.

When the counter "PageHits" is reset by NetCloak, the page will be automatically updated to display the date the counter was reset.

The optional "offset" parameter allows you to display the date offset from the current date and time. This is useful for displaying the date in another time zone. The offset must be preceded by a "+" for a forward offset or "-" for a backwards offset, and is specified in hours and tenths of hours. For example,

    <INSERT_COUNTERDATE PageHits +3.5>

The optional "format" parameter is used to control how the date appears. If needed, use "LONG" for the Long Date specified in the Date & Time control panel, and "SHORT" for the Short Date format. The format may be specified without specifying an offset. For example,

    <INSERT_COUNTERDATE PageHits SHORT>

If the specified counter does not exist, the text "*Unknown Counter*" is inserted into the page. If the specified counter exists, but has never been reset, the text "*Never Reset*" is inserted into the page.

See the INSERT_DATE command for more examples and sample dates in each format.

<INSERT_COUNTERTIME counter offset format >

The INSERT_COUNTERTIME has the same purpose and functions in the same way as the INSERT_COUNTERDATE command above. Of course, instead of displaying the date a counter was last reset, this command displays the exact time. To expand on the example above:

    There have been <INSERT_COUNT PageHits> visitors to this page since 
    <INSERT_COUNTERTIME PageHits> on <INSERT_COUNTERDATE PageHits>.

Like the INSERT_TIME command, an "offset" can be specified as a number of hours difference between the system date of the server and the time to be displayed. The optional "format" parameter can also be used to tell NetCloak whether seconds should be displayed or not.

If the specified counter does not exist, the text "*Unknown Counter*" is inserted into the page. If the specified counter exists, but has never been reset, the text "*Never Reset*" is inserted into the page.

See the INSERT_TIME command for more details.


Copyright © 1996-1999 Maxum Development Corporation

http://www.maxum.com/
Previous | Next
Contents